#include <iostream>
using namespace std;


int main ()
{
	int salary[3], test_cases;

	cin >> test_cases;
	for( int t = 1; t <= test_cases; ++t )
	{
		cout << "Case " << t << ": ";
		cin >> salary[0] >> salary[1] >> salary[2];
		if( salary[0] < salary[1] )
		{
			if( salary[0] < salary[2] )
			{
				cout << min( salary[1], salary[2] );
			}
			else
			{
				cout << salary[0];
			}
		}
		else
		{
			if( salary[0] < salary[2] )
			{
				cout << salary[0];
			}
			else
			{
				cout << max( salary[1], salary[2] );
			}
		}
		cout << endl;
	}

	return 0;
}